home *** CD-ROM | disk | FTP | other *** search
Text File | 2000-04-25 | 17.5 KB | 622 lines | [TEXT/R*ch] |
- /*
- File: SampleInstall.r
-
- Contains: xxx put contents here xxx
-
- Version: xxx put version here xxx
-
- */
-
-
- #include "Types.r"
- #include "InstallerTypes.r"
- #include "Gestalt.r"
- #include "AtomDefs.h"
-
- //======================================================================
- // Gestalt constant as yet not defined in Gestalt.h UI&L 3.2
- //======================================================================
-
- #define gestaltPowerMacNewWorld 406
- #define gestaltPowerExpress 409 // for never released cpu still common at apple
-
-
- //======================================================================
- // Global constants
- //======================================================================
-
- // Assertion contants
-
- #define aPCIPowerMac 1
- #define aHasOKSystem 2
- #define aHasUSB14 3
-
-
-
- // Rule contants
-
- #define rHasOKSystem 701
- #define rIsPCIPowerPC 702
- #define rHasUSB14 703
- #define rSampleInstall 704
- #define rSampleInstall14 705
- #define rSampleInstallPre14 706
- #define cSampleInstall 707
- #define cSampleInstall14 708
- #define cSampleInstallPre14 709
-
-
- #define errSystemNotOK 750
- #define errMachineNotOK 751
-
- // constants for packages, comments, comment text
-
- #define pSample 801
- #define pSampleLiveUpdate 802
-
-
- // file atom constants
-
- #define faSampleDriver 1000
- #define faSampleShim 1001
-
- // file target constants
-
-
- #define ftSampleDriver 2000
- #define ftSampleShim 2001
-
- // source target constants
-
- #define fsSystemFile 900
-
- #define fsSampleDriver 1000
- #define fsSampleShim 1001
- #define fsSampleTome 1002
-
- #define aaAddShimToDisk 9000
- #define rlUSBVersFn14 9001
-
- include "InstaCompAtomExt.rsrc" 'inex' (242);
- include "InstaCompAtomExt.rsrc" 'exfn' (242);
-
- //======================================================================
- // Version String constants
- //======================================================================
-
- #define SampleVersionString "1.0d1"
- #define SampleHexVersion 0x01001000
-
-
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- //
- // • Installer Version Resource
- //
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
- // This way the Installer script can only be opened by Installer Engine 4.5 and later.
- resource 'invs' (1) {
- format0 {
- 0x04, 0x08, 0x80, 0x00,
- "4.08"
- }
- };
-
-
- //======================================================================
- // Global Framework resources ('infr')
- //======================================================================
-
- //----------------------------------------------------------------------
- // • Global Rules FrameworkRsrc
- //
- // This framework is always called prior to the easy or custom install
- // frameworks. Use it for global assertions and tests that need to
- // be done regardless of the type of intstall being done
- //----------------------------------------------------------------------
-
- resource 'infr' (kGlobalFrameworkRsrcID) {
- format0 {{
- // run our global rules.
- pickFirst, {
- rHasOKSystem,
- errSystemNotOK
- },
- pickFirst, {
- rIsPCIPowerPC,
- errMachineNotOK
- },
- pickFirst, {
- rHasUSB14
- }
- }}
- };
-
- //----------------------------------------------------------------------
- // • Easy Install FrameworkRsrc
- //
- // Easy install framework references all top-level packages that will be
- // installed when the user selects the 'Easy Install' option of the
- // Installer.
- //----------------------------------------------------------------------
-
- resource 'infr' (kEasyInstallFrameworkRsrcID) {
- format0 {{
- // execute first true rule, if none are true then return false
- pickFirst, {
- rSampleInstall14, rSampleInstallPre14
- },
- }}
- };
-
- //----------------------------------------------------------------------
- // • Custom Install FrameworkRsrc
- //
- // Custom install framework references all top-level packages that will be
- // visible when the user selects the 'Custom Install' option of the
- // Installer.
- //----------------------------------------------------------------------
-
- resource 'infr' (kCustomInstallFrameworkRsrcID) {
- format0 {{
- // execute first true rule, if none are true then return false
- pickFirst, { // check CPU version, if PCI PowerMac but not New World system, then
- cSampleInstall14, cSampleInstallPre14
- },
- }}
- };
-
-
- //======================================================================
- // Installer Rules resources ('inrl')
- //======================================================================
-
- //----------------------------------------------------------------------
- // • Global Config rules
- //
- // Top-level rule that sets assertions depending on configuration
- //----------------------------------------------------------------------
-
- resource 'inrl' (rHasOKSystem)
- {
- format0
- {{
- checkFileVersion {fsSystemFile, 8, 5, release, 0},
- addAssertion {{aHasOKSystem}}
- }};
- };
-
- resource 'inrl' (rIsPCIPowerPC)
- {
- format0
- {{
- // Set the 'aPowerMac' assertion if this is a Power Macintosh which can have
- // a USB PCI or Cardbus card installed
- CheckGestalt{ gestaltMachineType,
- { gestaltPowerMac6400,
- gestaltPowerMac9500,
- gestaltPowerMac7500,
- gestaltPowerMac8500,
- gestaltPowerMac5400,
- gestaltPowerMac7200,
- gestaltPowerMac7300,
- gestaltPowerMacG3,
- gestaltPowerMac5500,
- gestaltPowerMac6500,
- gestaltPowerMac4400_160,
- gestaltPowerMac4400,
- gestaltPowerExpress,
- gestaltPowerMacNewWorld}},
- AddAssertion {{ aPCIPowerMac }}
- }};
- };
-
- resource 'inrl' (errSystemNotOK)
- {
- format0
- {{
- reportVolError
- {
- "This version of Mac OS USB can only be "
- "installed on PCI Power Macintoshes running MacOS "
- "8.5 or later!"
- },
- }};
- };
-
- resource 'inrl' (errMachineNotOK)
- {
- format0
- {{
- reportSysError
- {
- "Mac OS USB can only be installed on a "
- "PCI Power Macintosh System"
- },
- }};
- };
-
- resource 'inrl' (rHasUSB14, "Check if USV v1.4 is present")
- {
- format0
- {{
- checkRuleFunction{ rlUSBVersFn14 },
- AddAssertion {{ aHasUSB14 }}
- }};
- };
-
-
-
- //----------------------------------------------------------------------
- // • Rules to install the various packages
- //
- //----------------------------------------------------------------------
-
- resource 'inrl' (rSampleInstall14) {
- format0 {{
- // this returns false unless OS is right version
- checkAllAssertions{{ aHasOKSystem }},
-
- // this returns false unless CPU is PCI Power Macintosh
- checkAllAssertions{{ aPCIPowerMac }},
-
- // this returns false unless CPU is PCI Power Macintosh
- checkAllAssertions{{ aHasUSB14 }},
-
- // if PCI Power Macintosh CPU, add the Sample module package.
- AddPackages{{ pSampleLiveUpdate }},
- addUserDescription {"Click Install button to install\n" },
- AddUserDescription{ "• Sample Prototype Driver " SampleVersionString ".\n" },
- AddUserDescription{ "USB Version 1.4 or greater present" ".\n" },
- }}
- };
-
- resource 'inrl' (rSampleInstallPre14) {
- format0 {{
- // this returns false unless OS is right version
- checkAllAssertions{{ aHasOKSystem }},
-
- // this returns false unless CPU is PCI Power Macintosh
- checkAllAssertions{{ aPCIPowerMac }},
-
- // if PCI Power Macintosh CPU, add the Sample module package.
- AddPackages{{ pSample }},
- addUserDescription {"Click Install button to install\n" },
- AddUserDescription{ "• Sample Prototype Driver " SampleVersionString ".\n" },
- AddUserDescription{ "USB Version 1.3 or earlier present" ".\n" },
- }}
- };
-
-
- //----------------------------------------------------------------------
- // • Custom Install rules
- //
- // rule that adds USB packages for the custom install.
- //----------------------------------------------------------------------
-
- resource 'inrl' (cSampleInstall14) {
- format0 {{
- // this returns false unless OS is right version
- checkAllAssertions{{ aHasOKSystem }},
-
- // this returns false unless CPU is PCI Power Macintosh
- checkAllAssertions{{ aPCIPowerMac }},
-
- // this returns false unless CPU is PCI Power Macintosh
- checkAllAssertions{{ aHasUSB14 }},
-
- // if PCI Power Macintosh CPU, add the Sample module package.
- addCustomItems{{ pSampleLiveUpdate }},
- }}
- };
-
- resource 'inrl' (cSampleInstallPre14) {
- format0 {{
- // this returns false unless OS is right version
- checkAllAssertions{{ aHasOKSystem }},
-
- // this returns false unless CPU is PCI Power Macintosh
- checkAllAssertions{{ aPCIPowerMac }},
-
- // if PCI Power Macintosh CPU, add the Sample module package.
- addCustomItems{{ pSample }},
- }}
- };
-
-
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- //
- // • Features (packages)
- //
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
- resource 'inpk' (pSample) {
- format0 {
- showsOnCustom, // show the package as a selectable item
- // item when used as a subpackage
-
- removable, // show under Custom Remove as a selectable
- // item, when package is a subpackage
-
- forceRestart, // require user reboot after installation
-
- 0, // package comments resource ID
-
- 0, // package size ( if 0, filled by ScriptCheck )
-
- "Basic Mac OS USB Components", // Custom Install selection description
- {
- 'infa', faSampleDriver, // file to install
- 'infa', faSampleShim, // file to install
- },
- }
- };
-
- resource 'inpk' (pSampleLiveUpdate) {
- format0 {
- showsOnCustom, // show the package as a selectable item
- // item when used as a subpackage
-
- removable, // show under Custom Remove as a selectable
- // item, when package is a subpackage
-
- dontForceRestart, // require user reboot after installation
-
- 0, // package comments resource ID
-
- 0, // package size ( if 0, filled by ScriptCheck )
-
- "Basic Mac OS USB Components", // Custom Install selection description
- {
- 'infa', faSampleDriver, // file to install
- 'infa', faSampleShim, // file to install
- 'inaa', aaAddShimToDisk,
- },
- }
- };
-
- // • package comments
-
- resource 'inpc' ( pSample ) {
- format1 {
- 0, // sample date ( 08/08/94 seconds since 1904)
- SampleHexVersion, // sample version ( 8.0.1 GM)
-
- 0, // Ignored, not shown in user interface
-
- 0, // icon resource ID ( 'ICN#', 'icl4', 'icl8' )
- // - ID must be greater than 1024
- // - resource item is in included rsrc file
-
- pSample // 'TEXT' resource ID of item containing package description
- }
- };
-
- data 'TEXT' ( pSample ) { "This feature installs the Sample chip module and shim." };
-
- resource 'inpc' ( pSampleLiveUpdate ) {
- format1 {
- 0, // sample date ( 08/08/94 seconds since 1904)
- SampleHexVersion, // sample version ( 8.0.1 GM)
-
- 0, // Ignored, not shown in user interface
-
- 0, // icon resource ID ( 'ICN#', 'icl4', 'icl8' )
- // - ID must be greater than 1024
- // - resource item is in included rsrc file
-
- pSample // 'TEXT' resource ID of item containing package description
- }
- };
-
- data 'TEXT' ( pSampleLiveUpdate ) { "This feature installs the Sample Driver module and shim and activates the shim on the fly." };
-
-
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- //
- // • File Copy Commands
- //
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
- resource 'infa' (faSampleDriver) {
- format1 {
- deleteWhenRemoving, // Delete on deinstall
- deleteWhenInstalling, // Remove preexisting
- copy, // Copy on Install
- dontIgnoreLockedFile, // Respect file locking
- dontSetFileLocked, // Leave installed file unlocked
- useVersProcToCompare, // Compare newness of file based on 'vers' resource
- srcNeedNotExist, // Create a new file if necessary
-
- // this line must be set to "rsrcForkInDataFork" when working
- // file items compressed into InstaCompOne archives
- rsrcForkInDataFork, // • Resource fork in Data fork
-
- leaveAloneIfNewer, // Do not update a newer file
- updateExisting, // Update an existing file
- copyIfNewOrUpdate, // Copy whether target exists or not
- rsrcFork, // Copy resource fork
- dataFork, // Copy data fork
-
- 0, // TARGET - size ( filled in by ScriptCheck )
- 0x0, // finder attribute flags ( filled in by ScriptCheck )
- ftSampleDriver, // TARGET - file spec ( 'intf' )
- {
- fsSampleTome, // SOURCE - file spec ( 'infs' )
- 0, // DATA fork - size ( filled in by ScriptCheck )
- 0 // RSRC fork - size ( filled in by ScriptCheck )
- },
-
- 0x0, // SOURCE - version number for comparisons
- // not used here
-
- 0, // 'invc' code resource - version comparison routine
- // ( none used here )
-
- 242, // 'inex' resource definition for atom extender
- // • #242 is for PPC InstaCompOne extender
-
- "SampleDriver" // file atom description
- }
- };
-
- resource 'infa' (faSampleShim) {
- format1 {
- deleteWhenRemoving, // Delete on deinstall
- deleteWhenInstalling, // Remove preexisting
- copy, // Copy on Install
- dontIgnoreLockedFile, // Respect file locking
- dontSetFileLocked, // Leave installed file unlocked
- useVersProcToCompare, // Compare newness of file based on 'vers' resource
- srcNeedNotExist, // Create a new file if necessary
-
- // this line must be set to "rsrcForkInDataFork" when working
- // file items compressed into InstaCompOne archives
- rsrcForkInDataFork, // • Resource fork in Data fork
-
- leaveAloneIfNewer, // Do not update a newer file
- updateExisting, // Update an existing file
- copyIfNewOrUpdate, // Copy whether target exists or not
- rsrcFork, // Copy resource fork
- dataFork, // Copy data fork
-
- 0, // TARGET - size ( filled in by ScriptCheck )
- 0x0, // finder attribute flags ( filled in by ScriptCheck )
- ftSampleShim, // TARGET - file spec ( 'intf' )
- {
- fsSampleTome, // SOURCE - file spec ( 'infs' )
- 0, // DATA fork - size ( filled in by ScriptCheck )
- 0 // RSRC fork - size ( filled in by ScriptCheck )
- },
-
- 0x0, // SOURCE - version number for comparisons
- // not used here
-
- 0, // 'invc' code resource - version comparison routine
- // ( none used here )
-
- 242, // 'inex' resource definition for atom extender
- // • #241 is for PPCInstaCompOne extender
-
- "SampleShim" // file atom description
- }
- };
-
-
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- //
- // • Target File Descriptions
- //
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-
- resource 'intf' (ftSampleDriver) {
- format1 {
- noSearchForFile, // use default search path
- TypeCrNeedNotMatch, // target type and creator don't have to match
- 'ndrv', // TYPE given to new file
- 'usbd', // CREATOR given to new file
-
- 0x0, // Target - finder flags
- // ( ScriptCheck fills in flags if set to 0 )
-
- 0x1, // Target - creation date
- 0x1, // Target - mod date
- // ( ScriptCheck fills in dates if set to 1 )
-
- 0, // 'insp' resource ID ( file search proc )
- "special-extn:SampleDriver" // path to target file
- }
- };
-
- resource 'intf' (ftSampleShim) {
- format1 {
- noSearchForFile, // use default search path
- TypeCrNeedNotMatch, // target type and creator don't have to match
- 'ndrv', // TYPE given to new file
- 'usbs', // CREATOR given to new file
-
- 0x0, // Target - finder flags
- // ( ScriptCheck fills in flags if set to 0 )
-
- 0x1, // Target - creation date
- 0x1, // Target - mod date
- // ( ScriptCheck fills in dates if set to 1 )
-
- 0, // 'insp' resource ID ( file search proc )
- "special-extn:SampleShim" // path to target file
- }
- };
-
-
-
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- //
- // • Source File Descriptions
- //
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
- // source file spec for Example File #1
- // • simple compression
- // source file spec for compressed "Example File" file
- resource 'infs' (fsSampleTome) {
- 'idcp', // TYPE
- 'kakc', // CREATOR
- 0x0, // creation DATE for source file
- noSearchForFile, // IGNORED in Installer 4.0.x
- TypeCrMustMatch, // TYPE, CREATOR must match file on install disk
- "SampleDisk:SampleTome" // PATH to source file
- };
-
- resource 'intf' (fsSystemFile)
- {
- format1
- {
- noSearchForFile,
- TypeCrNeedNotMatch,
- 'zsys', 'MACS',
- 0,
- 1,
- 1,
- 0,
- "special-macs:System" /* path name */
- };
- };
-
- resource 'inaa' ( aaAddShimToDisk ) {
- format2{
- continueBusyCursors,
- actAfter, // when to run action atom
- dontActOnRemove, // run action atom on removal
- actOnInstall, // run action atom on install
- 'infn', // resource type of code resource
- 9000, // resource ID of code resource
- 0, // refcon ID
-
- // NOTE: Enter zero for this value to use the installer's heap,
- // or enter size in bytes to have this action atom use it's own heap.
- // All earlier action atom formats use the installer's heap.
- // IMPORTANT: enter zero for this field unless you have a specific
- // reason for your action atom to use memory from it's own heap.
- 0, // requested memory in bytes
-
- "addShimFromDisk atom" // description of atom
- }
- };
-
- resource 'inrf' (rlUSBVersFn14) {
- format0 {
- userFunctionType, // code resource type
- rlUSBVersFn14, // code resource ID
- 0x01400000, // refCon - USB 1.4 any release
-
- 0, // use installer's heap,
- // instead of a seperate subheap
-
- "This Rule Function returns TRUE if USB v1.4 is active"
- }
- };
-
-
- resource 'STR ' (kShimSTRid) {"SampleShim"};
-